<?php
/**
 * 注册相关服务器
 * @author haiqin
 *
 */
namespace Users\Service;
class RegService{
	private $invitation;
	
	public function __construct() {
		$this->invitation = D('UsersInvitation');
	}
	
	//验证邀请码
	public function checkInvitation($value){
		$con['invite_code'] = $value;
		$con['hasuse'] = 2;
		$info = $this->invitation->where($con)->find();
		if($info){
			return $info;
		}else{
			return false;
		}
	}
	
	//设置邀请码为已使用
	public function useInvitation($value){
		$con['invite_code'] = $value;
		$data['hasuse'] = 1;
		if($this->invitation->where($con)->save($data)){
			return true;
		}else{
			return false;
		}
	}
}
?>